<%@ page language="java" import="java.util.*,com.king.cms.common.*, com.king.cms.orm.CmsUser" pageEncoding="UTF-8"%>
<jsp:directive.page import="com.king.cms.db.DBOperator"/>
<%@ include file="/hotel/include/css.jsp"%><%-- /*包含css样式表*/ --%> 
<%
String flag = request.getParameter("save");
if(flag != null){
  String uid = request.getParameter("uid");
  String newpass = request.getParameter("newpass");  
  if(uid != null){
       
     String  pass  = newpass;
     if(InitSystem.getBpmParam("isUseMd5") != null && "true".equals(InitSystem.getBpmParam("isUseMd5")))
         pass =MD5.md5(newpass);
     DBOperator dbo = new DBOperator(session.getServletContext());
      
     dbo.update("update cms_user set user_pass=? where UID=?",new Object[]{pass,uid});
     out.print("<script>");
     out.print("alert('密码修改成功');");
     out.print("window.close();");
      out.print("</script>");
  }



}



 %>
<html>
<head>
<title>信息发布系统-修改密码</title>
<script>
function changepass(){
   var flag = true;
    if(clskg(form1.uid.value) == ''){
       alert('用户名不能为空或空格字符');
       
       flag = false;
       return;
   }
   if(clskg(form1.newpass.value) == ''){
       alert('新密码不能为空或空格字符');
       
       flag = false;
       return;
   }
   if(clskg(form1.confirmpass.value) == ''){
       alert('确认新密码不能为空或空格字符'); 
       flag = false;
       return;
   }
   if(clskg(form1.newpass.value)!= clskg(form1.confirmpass.value)){
       alert('两次输入密码不一致'); 
       flag = false;
       return;
   }
   form1.submit()


}
function clskg(va){
	  var th=/\s/g;
	  va=va.replace(th,'');
	 return va;
	}
</script>
<head>
</head>
<body>
<form name="form1"   method="post" action="initpass.jsp"> 
<center>
<br>
<table border="0" cellpadding="4" cellspacing="1" style="border-collapse: collapse;" bordercolor="#111111" class="bg_table" width="80%"  align="center">
  <tr>
    <td class="top_td" colspan="2" align="center">修改密码</td>
  </tr>
   <tr class="td3" > 
    <td align="center" >用户名：</td> 
    <td align="center" ><input type="text" class="area100" name="uid" value=""></td>
  </tr> 
    <tr class="td3" > 
    <td align="center" >输入新密码：</td> 
    <td align="center" ><input type="hidden" class="area100" name="save" value="true"><input type="password" class="area100" name="newpass" value=""></td>
  </tr> 
  <tr class="td3" > 
    <td align="center" >确认新密码：</td> 
    <td align="center" ><input type="password" class="area100" name="confirmpass" value=""></td>
  </tr> 
  <tr class="td2" > 
    <td align="center" colspan="2"><input type="button" class="area100" onclick="changepass()" value="确定">&nbsp;<input type="button" class="area100" onclick="window.close();" value="取消"></td> 
   
  </tr>   
</table>
</center>
</form> 
</body>
</html>